<!DOCTYPE html>
<html>
<head>
    <title>数字排序</title>
</head>
<body>
    <input type="number" id="n1">
    <input type="number" id="n2">
    <input type="number" id="n3">
    <button onclick="sortNumbers()">排序</button>
    <p id="sorted"></p>

    <script>
        function sortNumbers() {
            const nums = [
                parseFloat(document.getElementById('n1').value),
                parseFloat(document.getElementById('n2').value),
                parseFloat(document.getElementById('n3').value)
            ];
            
            if(nums.some(isNaN)) {
                document.getElementById('sorted').innerText = "请输入有效数字";
                return;
            }
            
            nums.sort((a, b) => a - b);
            document.getElementById('sorted').innerText = `排序结果: ${nums.join(', ')}`;
        }
    </script>
</body>
</html>